package com.ajk.server.controller;

import java.security.Principal;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.ajk.server.controller.access.ArgIndexForPrintLog;
import com.ajk.server.model.EaseUser;
import com.ajk.server.model.response.ResultObject;
import com.ajk.server.service.EasemobMessageService;

@RestController
@RequestMapping("/easemod")
public class EasemobMessageController {
	
	@Autowired
	EasemobMessageService easemobMessageService;
	
	@ArgIndexForPrintLog(indexes={0})
	@RequestMapping(value = "/my_easemod_account", method = RequestMethod.GET)
	public ResultObject<EaseUser> findMyEasemodAccount(Principal principal){
		Integer userId = Integer.parseInt(principal.getName());
		EaseUser user = easemobMessageService.findByEaseUserByUserId(userId);
		return new ResultObject<>(user);
	}
}
